package com.csst.bean;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.FetchType;
import javax.persistence.GenerationType;

import javax.persistence.Column;

import javax.persistence.Entity;

import javax.persistence.GeneratedValue;

import javax.persistence.Id;

import javax.persistence.OneToOne;

import javax.persistence.Table;


@Entity(name = "User")
@Table(name = "User")
public class User implements Serializable {

	private static final long serialVersionUID = 691350277643811847L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "UserId",nullable=true)
	private Integer userId;

	@Column(length = 20,nullable=true, unique=true)
	private String username;

	@Column(length = 50,nullable=true)
	private String email;
	@Column(length = 20,nullable=true)
	private String password;
	@Column(length = 20,nullable=true)
	private String regtime;
	@OneToOne(cascade = CascadeType.ALL, mappedBy = "user", fetch=FetchType.LAZY)
	private Account account;
	
	@OneToOne(cascade = CascadeType.ALL, mappedBy = "user",fetch=FetchType.LAZY)
	private UserBank userbank;

	public User() {

	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getRegtime() {
		return regtime;
	}

	public void setRegtime(String regtime) {
		this.regtime = regtime;
	}


	public void setUserbank(UserBank userbank) {
		this.userbank = userbank;
	}

	public UserBank getUserbank() {
		return userbank;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	public Account getAccount() {
		return account;
	}

	@Override
	public String toString() {
		return "User [account=" + account + ", email=" + email + ", password="
				+ password + ", regtime=" + regtime + ", userId=" + userId
				+ ", userbank=" + userbank + ", username=" + username + "]";
	}
}
